﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace TripleGameServices
{
    [ServiceContract]
    public interface ITripleGameServices
    {
        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare,
            RequestFormat = WebMessageFormat.Json, UriTemplate = "players/addNewPlayer/")]
        int AddPlayer(PlayerDC playerDC);

        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare,
            RequestFormat = WebMessageFormat.Json, UriTemplate = "players/deletePlayer/")]
        void DeletePlayer(PlayerDC playerDC);

        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare,
            RequestFormat = WebMessageFormat.Json, UriTemplate = "games/addPendingGame/")]
        int AddPendingGame(PlayerDTO player);

        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "games/getAllPendingGames/")]
        IEnumerable<PendingGameDTO> GetAllPendingGames();

        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare,
            RequestFormat = WebMessageFormat.Json, UriTemplate = "games/joinGame/")]
        int JoinGame(PendingGameDTO pendingGameDTO);
    }

    [DataContract]
    public class PlayerDC
    {
        [DataMember]
        public string playerName { get; set; }

        [DataMember]
        public string playerId { get; set; }
    }
}
